package cn.itcast.cd.query;

import java.util.ArrayList;
import java.util.List;

public class BaseQuery implements IQuery {

	 protected List conditions = new ArrayList();
	 protected List params = new ArrayList();
	 
	 private int currentPage=1;
	 private int pageSize=10;

	@Override
	public Object[] getParams() {
		return null;
	}

	public String getQuery(){
		conditions.clear();
		conditions = getConditions();
		StringBuilder sb = new StringBuilder();
		if(conditions!=null && conditions.size()>0){
			for (int i = 0; i < conditions.size(); i++) {
				sb.append(conditions.get(i));
			}
		}
		System.out.println(sb.toString());
		return sb.toString();
	}

	@Override
	public List getConditions() {
		return null;
	}

	
	@Override
	public int getCurrentPage() {
		
		return currentPage;
	}

	@Override
	public void setCurrentPage(int currentPage) {
		this.currentPage = currentPage;
	}

	@Override
	public void setPageSize(int pageSize) {
		this.pageSize = pageSize;
	}

	@Override
	public int getPageSize() {
		return pageSize;
	}

	@Override
	public int getStart() {
		return (currentPage-1)*pageSize;
	}

}
